<?php
namespace App\Admin\Renderable\Shop;

use App\Models\Shop\WxShopNotice;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class ShopNoticeRender extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new WxShopNotice(), function (Grid $grid) {
            $grid->simplePaginate();
            $grid->model()->orderBy('id', 'desc');
            $grid->column('id')->sortable();
            $grid->column('title');
            $grid->column('content')->limit(8);
            $grid->column('state')->switch();
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
            });
        });
    }
}
